package svg.main;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

import svg.action.NewFileAction;
import svg.action.NewPackageAction;
import svg.action.OpenFileAction;
import svg.action.OpenPackgeAction;
import svg.util.Config;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private IWorkbenchAction exitAction = null;
	private IWorkbenchAction openFileAction = null;
	private IWorkbenchAction openPackageAction = null;
	private IWorkbenchAction newFileAction = null;
	private IWorkbenchAction newPackageAction = null;
	
    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {
    	openFileAction = new OpenFileAction(window);
    	register(openFileAction);
    	openPackageAction = new OpenPackgeAction(window);
    	register(openPackageAction);
    	newFileAction = new NewFileAction(window);
    	register(newFileAction);
    	newPackageAction = new NewPackageAction(window);
    	register(newPackageAction);
    	exitAction = ActionFactory.QUIT.create(window);
    	register(exitAction);
    }

    protected void fillMenuBar(IMenuManager menuBar) {
    	MenuManager fileMenuMgr = new MenuManager(Config.getString("MENU.FILE.TEXT"),"file");
    	fileMenuMgr.add(newFileAction);
    	fileMenuMgr.add(openFileAction);
    	fileMenuMgr.add(new Separator());
    	fileMenuMgr.add(newPackageAction);
    	fileMenuMgr.add(openPackageAction);
    	fileMenuMgr.add(new Separator());
    	fileMenuMgr.add(exitAction);
    	menuBar.add(fileMenuMgr);
    }
    
}
